#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>

void *print_message_function( void *ptr );

int main()
{
     pthread_t readThread, tlbfillUpThread;
     const char *message1 = "Read thread";
     const char *message2 = "TLB fill up thread";
     int  iret1, iret2;

    /* Create independent threads each of which will execute function */

     iret1 = pthread_create( &readThread, NULL, print_message_function, (void*) message1);
     iret2 = pthread_create( &tlbfillUpThread, NULL, print_message_function, (void*) message2);

     /* Wait till threads are complete before main continues. Unless we  */
     /* wait we run the risk of executing an exit which will terminate   */
     /* the process and all threads before the threads have completed.   */

     pthread_join( readThread, NULL);
     pthread_join( tlbfillUpThread, NULL);

     printf("%s returns: %d\n",message1, iret1);
     printf("%s returns: %d\n",message2, iret2);
     return EXIT_SUCCESS;
}

void *print_message_function( void *ptr )
{
     char *message;
     message = (char *) ptr;
     printf("%s \n", message);
}
